//
//  CollectedCell.m
//  ZYTS-iPhone
//
//  Created by yuzhou on 13-2-6.
//  Copyright (c) 2013年 wzyk. All rights reserved.
//

#import "CollectedCell.h"
#import "UIImageView+WebCache.h"

@implementation CollectedCell

- (id)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        // Initialization code
    }
    return self;
}

- (id)initWithFrame:(CGRect)frame reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithFrame:frame reuseIdentifier:reuseIdentifier];
    if (self) {
        // Initialization code
        self.backgroundColor = [UIColor clearColor];
        self.contentView.backgroundColor = [UIColor clearColor];
        
        coverImageView = [[UIImageView alloc] initWithFrame:CGRectMake(7, 11, 83, 105)];
        coverImageView.contentMode = UIViewContentModeScaleAspectFit;
        coverImageView.image = [UIImage imageNamed:@"default_image"];
        [self.contentView addSubview:coverImageView];
        
        coverImageView.layer.shadowColor = [UIColor blackColor].CGColor;
        coverImageView.layer.shadowOpacity = 0.45f;
        coverImageView.layer.shadowOffset = CGSizeMake(-6.0f, -8.0f);
        coverImageView.layer.masksToBounds = NO;
        UIBezierPath *path = [UIBezierPath bezierPathWithRect:coverImageView.frame];
        coverImageView.layer.shadowPath = path.CGPath;
    }
    return self;
}

- (void)updateDisplay
{
    NSString *imageUrl = [[_infoDic valueForKey:@"image"] stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
    [coverImageView setImageWithURL:[NSURL URLWithString:imageUrl] placeholderImage:[UIImage imageNamed:@"default_image"]];
}

- (void)dealloc
{
    [_infoDic release];
    [coverImageView release];
    [super dealloc];
}

@end
